// API - 表格模板分类

import { http } from "@/utils/http";
import { errorReject } from "@/utils/truncate";
import { message } from "@/utils/message";

interface typesResult extends HttpResponse {
  data?: TempTableCatalogs[];
}

export type TempTableCatalogs = {
  id: Id;
  name: string;
};

/**
 * 获取完整分类
 *
 * @param params 请求参数
 * @returns
 */
export const getTempCatalogs = async (params?: object) => {
  return errorReject(
    http.request<typesResult>("get", "/template/table/catalogs", {
      params
    }),
    error => {
      message(error.message, { type: "error" });
    }
  );
};
